package com.itheima.wemedia.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.common.pojo.Result;
import com.itheima.wemedia.pojo.WmUser;
import com.itheima.wemedia.service.WmUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.RestController;
    import com.itheima.core.controller.AbstractCoreController;

/**
* <p>
* 自媒体用户信息表 控制器</p>
* @author czh
* @since 2021-08-20
*/
@RestController
@RequestMapping("/wmUser")
public class WmUserController extends AbstractCoreController<WmUser> {

    private WmUserService wmUserService;

    //注入
    @Autowired
    public WmUserController(WmUserService wmUserService) {
        super(wmUserService);
        this.wmUserService=wmUserService;
    }

    /**
     * 根据用户id查询媒体用户信息
     */
    @GetMapping("/one/{apUserId}")
    public Result<WmUser> getByUserId(@PathVariable Integer apUserId){
        QueryWrapper<WmUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("ap_user_id",apUserId);
        WmUser wmUser = wmUserService.getOne(queryWrapper);
        return Result.ok(wmUser);

    }

}

